//
//  Test18.cpp
//  CPPTest
//
//  Created by you5 Yi on 2021/9/25.
//

#include "Test18.hpp"
#include <iostream>
using namespace std;

class Simple {
    int x,y;
public:
    Simple() {
        x = y = 0;
    }
    Simple(int i, int j) {
        x = i;
        y = j;
    }
    void copy(Simple &s);
    void setxy(int i, int j) {
        x = i;
        y = j;
    }
    void print() {
        cout<<"x = "<<x<<",y = "<<y<<endl;
    }
};

void Simple::copy(Simple &s)
{
    x = s.x;
    y = s.y;
}
void func(Simple s1, Simple &s2)
{
    s1.setxy(30, 40);
    s2.setxy(70, 80);
}

void test18()
{
    Simple obj1(1,2),obj2;
    obj2.copy(obj1);
    func(obj1, obj2);
    obj1.print();
    obj2.print();
}
